package com.wing.area;

import com.wing.common.utils.JsonResult;
import com.wing.enterprise.feign.EnterpriseClient;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Validated
@RestController("areaController")
@RequestMapping("area/admin/area")
@RequiredArgsConstructor
public class AreaController {

    @Autowired
    private EnterpriseClient enterpriseClient;

    @GetMapping("/getProvince")
    public JsonResult getProvince(){
        return enterpriseClient.getProvinceList();
    }

    @GetMapping("/getCity")
    public JsonResult getCity(Integer parentId){
        return enterpriseClient.getCityList(parentId);
    }

    @GetMapping("/getArea")
    public JsonResult getArea(Integer parentId){
        return enterpriseClient.getAreaList(parentId);
    }

}
